<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let obj = {};

        // 添加一个普通属性
        Object.defineProperty(obj, 'a', {
            value: 1,
            writable: true,
            enumerable: true,
            configurable: true
        });

        // 添加一个不可枚举的属性
        Object.defineProperty(obj, 'b', {
            value: 2,
            writable: true,
            enumerable: false,
            configurable: true
        });
        console.log(obj);

        console.log(Object.keys(obj)); // 输出: ['a']
    </script>
</body>

</html>